FROM --platform=linux/amd64 ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Add python3-pip to install python packages
RUN apt-get update && apt-get install -y \
    git python3 python3-distutils python3-pip build-essential ninja-build pkg-config curl clang \
    && rm -rf /var/lib/apt/lists/*

# Install depot_tools
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /opt/depot_tools
ENV PATH="/opt/depot_tools:${PATH}"

# Install python dependencies for depot_tools before running it
RUN pip3 install httplib2

# Bootstrap depot_tools to ensure all helper tools are downloaded
RUN python3 /opt/depot_tools/gclient.py --version
